"""
Problem 100: https://projecteuler.net/problem=100

"""


def solution(d: int = 12) -> int:
    """
    total > 10^d
    blues / total * (blues-1) / (total-1) =0.5
    return blues

    b^2 - b - t(t-1)/2 = 0
    b = (1 + sqrt(1+2t(t-1)))/2
    """

    t = 10**d
    while True:
        tmp = (1+2*t*(t-1))**0.5
        if tmp == int(tmp) and int(tmp)%2:
            return t,(1+t)//2
        else:
            t+=1



if __name__ == "__main__":
    from doctest import testmod

    testmod()
    print(solution())
    # (1000000002604, 500000001302)
